const cloud = require('wx-server-sdk')
const db = cloud.database()

exports.main = async (event, context) => {
  const todos = await db.collection('userInfo');
  console.log("getuserinfo===openid="+event.openid);
  /**return await db.collection('userInfo').get({
    success: function(res) {
      // res.data 是一个包含集合中有权限访问的所有记录的数据，不超过 20 条
      console.log("all list=");
      console.log(res.data);
      return res.data;
    }
  })**/
  var we = await todos.where({openid: event.openid});
  return await we.get({
    success: function(res) {
      return res.data;
    },
  })
}